package com.oxy.util;

public class SysErrException extends RuntimeException {
	private static final long serialVersionUID = 3719471327718257042L;
	
	private int errCd = 0;
	
	public SysErrException() {
		super();
    }
    public SysErrException(String message) {
    	super(message);
    }
    public SysErrException(int errCd, String message) {
    	super(message);
    	this.errCd = errCd;
    }
    public SysErrException(String message, Throwable cause) {
        super(message, cause);
    }
    public SysErrException(int errCd, String message, Throwable cause) {
    	super(message, cause);
    	this.errCd = errCd;
    }
    public SysErrException(int errCd, Throwable cause) {
    	super(cause);
    	this.errCd = errCd;
    }
    public SysErrException(Throwable cause) {
        super(cause);
    }
    
    public int getErrorCode() {
    	return errCd;
    }
    public String getErrorCodeStr() {
    	return String.format("%05d", errCd);
    }
    
    public String getErrorDesc() {
    	return SysErrManager.ERRORS.getErrDesc(this.errCd);
    }
    
    @Override
    public String toString() {
    	return "ERR"+getErrorCodeStr()+" - "+getErrorDesc()+"\r\n"+getMessage();
    }
}
